package com.st.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.st.entity.Attractions;
import com.st.entity.ScenicDetail;
import com.st.entity.Site;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AttractionsMapper extends BaseMapper<Attractions> {

    //查询所有城市
    @Select("select * from site")
    public List<Site> findAll();

    IPage<Attractions> findAttractions(IPage<Attractions> iPage, Attractions attractions);

    @Insert("insert into scenic_detail(name,site,attractions_id,business_hours) values (#{name},#{site},#{attractionsId},#{businessHours})")
    public int insertScenicDetail(ScenicDetail scenicDetail);

    @Update("update scenic_detail set name = #{name},site = #{site},business_hours = #{businessHours} where attractions_id = #{attractionsId} ")
    public int updateScenicDetail(ScenicDetail scenicDetail);

    //保存热门景点
    public List<Attractions> saveHot();
}
